package com.webflux.springwebflux.controller;

import com.webflux.springwebflux.pojo.Test;
import com.webflux.springwebflux.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private TestService testService;

    @GetMapping("/")
    public Mono<Test> test() {
        return testService.test();
    }

    @GetMapping("/list")
    public Flux<Test> list() {
        return testService.list();
    }

    @GetMapping("/page")
    public Mono<Page<Test>> page(){
        return testService.page();
    }
}
